
//节流
export  function throttle(callback, wait = 200) {
	let flag = true;
	return function (...args) {
		if (flag) {
		
			setTimeout(() => {
				callback.apply(this, args);
				flag = true;
			}, wait);
		}
		flag = false;
	};
}

export const debounce =function(callback,wait=500){
	let t=null;
	return function(...args){
		if(t!==null){
			clearTimeout(t)
		}
		t=setTimeout(() => {
			callback.apply(this,args)
		}, wait);

	}

}